﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;

namespace Himp.Outpatient
{
    /// <summary>
    /// 门诊支付记录
    /// </summary>
    public class OtpPayRecService : ApplicationService, IOtpPayRecService
    {
        private IRepository<OtpPayRec, Guid> _otpPayRecRepository;

        public OtpPayRecService(IRepository<OtpPayRec, Guid> otpPayRecRepository)
        {
            _otpPayRecRepository = otpPayRecRepository;
        }

        public async Task<OtpPayRecDto> PostAsync(OtpPayRecCreateDto input)
        {
            OtpPayRec otpPayRec = new OtpPayRec(input.OtpPayWayId, input.Amt, input.OtpOrdRecId, input.PayWayCode);
            otpPayRec = await _otpPayRecRepository.InsertAsync(otpPayRec);
            var itemDto = ObjectMapper.Map<OtpPayRec, OtpPayRecDto>(otpPayRec);

            return itemDto;
        }
    }
}
